package com.aaa.mythread;

public class MyThread3salrticket extends Thread{

    private String name;
    private int ticket=10;

    public MyThread3salrticket(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        //  业务

       while (ticket>0){
           System.out.println(name+"卖出了一张票，还有"+ticket--);
       }

    }


    public static void main(String[] args) {
        // 启动线程的唯一方式就是  调用start方法
        MyThread3salrticket myThread1 = new MyThread3salrticket("zs");
        myThread1.start();
        MyThread3salrticket myThread2 = new MyThread3salrticket("ls");
        myThread2.start();
        MyThread3salrticket myThread3 = new MyThread3salrticket("ww");
        myThread3.start();
    }
}
